import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { useRender } from '@/hooks/component/useRender';

export const formSchems: FormSchema[] = [
  {
    label: '创建时间',
    field: 'createTime',
    component: 'RangePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
];

const { renderDict } = useRender();

export const columns: BasicColumn[] = [
  {
    title: '店铺',
    dataIndex: 'shopName',
  },
  {
    title: '应用appId',
    dataIndex: 'appId',
  },
  {
    title: '小程序昵称',
    dataIndex: 'nickName',
  },
  {
    title: '图标',
    dataIndex: 'headImg',
  },
  {
    title: '公司名称',
    dataIndex: 'principalName',
  },
  {
    title: '是否提交代码',
    dataIndex: 'releaseStatus',
    customRender: ({ value }) => renderDict(value, 'RELEASE_STATUS'),
  },
  {
    title: '代码版本',
    dataIndex: 'releaseVersion',
  },
  {
    title: '状态说明',
    dataIndex: 'releaseReason',
  },
  {
    title: '状态',
    dataIndex: 'authType',
  },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键',
    field: 'id',
    required: true,
    component: 'Input',
    show: false,
  },
  {
    label: '应用appId',
    field: 'appId',
    required: true,
    component: 'Input',
  },
  {
    label: '昵称',
    field: 'nickName',
    required: true,
    component: 'Input',
  },
  {
    label: '头像',
    field: 'headImg',
    required: true,
    component: 'Input',
  },
  {
    label: '原始 ID',
    field: 'userName',
    required: true,
    component: 'Input',
  },
  {
    label: '主体名称',
    field: 'principalName',
    required: true,
    component: 'Input',
  },
  {
    label: '公众号所设置的微信号',
    field: 'alias',
    required: true,
    component: 'Input',
  },
  {
    label: '二维码图片的 URL，开发者最好自行也进行保存',
    field: 'qrcodeUrl',
    required: true,
    component: 'Input',
  },
  {
    label: '公众号类型:0:订阅号,1:由历史老帐号升级后的订阅号,2:服务号',
    field: 'serviceTypeInfo',
    required: true,
    component: 'Input',
  },
  {
    label:
      '公众号认证类型:-1:未认证,0:微信认证,1:新浪微博认证,2:腾讯微博认证,3:已资质认证通过但还未通过名称认证,4:已资质认证通过、还未通过名称认证，但通过了新浪微博认证,5:已资质认证通过、还未通过名称认证，但通过了腾讯微博认证',
    field: 'verifyTypeInfo',
    required: true,
    component: 'Input',
  },
  {
    label: '帐号介绍',
    field: 'signature',
    required: true,
    component: 'Input',
  },
  {
    label: '授权类型：ADD:新增授权，UPDATE:授权更新，DELETE:授权取消',
    field: 'authType',
    required: true,
    component: 'Select',
  },
  {
    label: '用以了解功能的开通状况',
    field: 'businessInfo',
    required: true,
    component: 'Input',
  },
  {
    label: '授权信息',
    field: 'authorizationInfo',
    required: true,
    component: 'InputTextArea',
  },
  {
    label: '授权码',
    field: 'authorizationCode',
    required: true,
    component: 'Input',
  },
  {
    label:
      '代码发布状态：NO:未发布，HANDLE:审核中，NOT:审核未通过，CODE_SUBMIT_SUCCESS:代码上传成功,YES:发布成功,HANDLE_AFTER:审核延后',
    field: 'releaseStatus',
    required: true,
    component: 'RadioButtonGroup',
  },
  {
    label: '代码发布描述',
    field: 'releaseReason',
    required: true,
    component: 'Input',
  },
  {
    label: '发布的版本号',
    field: 'releaseVersion',
    required: true,
    component: 'Input',
  },
  {
    label: '上一个版本',
    field: 'upReleaseVersion',
    required: true,
    component: 'Input',
  },
  {
    label: '代码发布id',
    field: 'releaseAuditId',
    required: true,
    component: 'Input',
  },
];
